﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace ModernUILogViewer.Converters
{
    /*
     * value = null
     *      parameter = false (default)
     *          return false
     *      parameter = true
     *          return true
     * value != null
     *      parameter = false (default)
     *          return true
     *      parameter = true
     *          return false
     * */
    class NullToBooleanConverter : IValueConverter
    {
        public object Convert(object value, Type TargetType, object parameter, CultureInfo culture)
        {            
            return (value == null) == Boolean.Parse((string)parameter ?? "False");
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
